#include "AttributeProxy.h"

std::string GetFileHeadAttributeValue(char16_t* str,long strLength)
{
  char16_t* handleStr=new char16_t[strLength+1];
  std::memcpy(handleStr,str,strLength*sizeof(char16_t));
  handleStr[strLength]='\0';
  icu::UnicodeString uniString(handleStr);
  std::string u8Str;
  uniString.toUTF8String(u8Str);
  delete [] handleStr;
  return u8Str;
}

//strLength不算空字符
void SetFileHeadAttributeValue(char16_t* str,long strLength,const std::string& newValue)
{
  icu::UnicodeString u16Str=icu::UnicodeString::fromUTF8(newValue);
  long minLength=std::min<long>(strLength,u16Str.length());
  std::memset(str,0,strLength);
  for(long i=0;i<minLength;i++)
  {
    str[i]=u16Str.charAt(i);
  }
}
